import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)


// 解决编程式路由往同一地址跳转时会报错的情况
const originalPush = Router.prototype.push;
const originalReplace = Router.prototype.replace;

// push
Router.prototype.push = function push(location, onResolve, onReject) {
  if (onResolve || onReject)
    return originalPush.call(this, location, onResolve, onReject);
  return originalPush.call(this, location).catch(err => err);
};

//replace
Router.prototype.replace = function push(location, onResolve, onReject) {
  if (onResolve || onReject)
    return originalReplace.call(this, location, onResolve, onReject);
  return originalReplace.call(this, location).catch(err => err);
};


export default new Router({
	// mode: 'history',
	// base: './',

	routes: [
    {
      path: '/',
      redirect:'/canshu'
    },
    {
    	path: '/canshu',
      component: () => import('@/view/canshu/index'),
      redirect:'/canshu/list',
      children:[
        {
          path: '/canshu/list',
          component: () => import('@/view/canshu/list'),
          mete:{
            title:"系统参数配置",
          },
        }
      ]
    },
    {
    	path: '/zidian',
      component: () => import('@/view/zidian/index'),
      redirect:'/zidian/zidian',
      children:[
        {
          path: '/zidian/zidian',
          component: () => import('@/view/zidian/zidian'),
          mete:{
            title:"字典管理",
          },
        },
        {
          path: '/zidian/zidianshuju',
          component: () => import('@/view/zidian/zidianshuju'),
          mete:{
            title:"字典数据",
          },
        }
      ]
    },
    {
    	path: '/caijizhan',
      component: () => import('@/view/caijizhan/index'),
      redirect:'/caijizhan/list',
      children:[
        {
          path: '/caijizhan/list',
          component: () => import('@/view/caijizhan/list'),
          mete:{
            title:"采集站管理",
          },
        }
      ]
    },
    {
    	path: '/caijizhanxin',
      component: () => import('@/view/caijizhanxin/index'),
      redirect:'/caijizhanxin/list',
      children:[
        {
          path: '/caijizhanxin/list',
          component: () => import('@/view/caijizhanxin/list'),
          mete:{
            title:"采集站管理新",
          },
        },
        {
          path: '/caijizhanxin/chakan',
          component: () => import('@/view/caijizhanxin/chakan'),
          mete:{
            title:"查看",
          },
        }
      ]
    },
    {
    	path: '/canshushezhi',
      component: () => import('@/view/caijizhanxin/index'),
      redirect:'/caijizhanxin/chakan',
      children:[
        {
          path: '/caijizhanxin/chakan',
          component: () => import('@/view/caijizhanxin/chakan'),
          mete:{
            title:"参数设置",
          },
        }
      ]
    },
    {
    	path: '/shujuchakan',
      component: () => import('@/view/shujuchakan/index'),
      redirect:'/shujuchakan/list',
      children:[
        {
          path: '/shujuchakan/list',
          component: () => import('@/view/shujuchakan/list'),
          mete:{
            title:"数据查看",
          },
        }
      ]
    },
    {
    	path: '/jiancebaogao',
      component: () => import('@/view/jiancebaogao/index'),
      redirect:'/jiancebaogao/list',
      children:[
        {
          path: '/jiancebaogao/list',
          component: () => import('@/view/jiancebaogao/list'),
          mete:{
            title:"监测报告",
          },
        }
      ]
    },

    {
    	path: '/shujufenxi',
      component: () => import('@/view/shujufenxi/index'),
      redirect:'/shujufenxi/shujufenxi',
      children:[
        {
          path: '/shujufenxi/shujufenxi',
          component: () => import('@/view/shujufenxi/shujufenxi'),
          mete:{
            title:"数据分析",
          },
        }
      ]
    },
    {
    	path: '/pinpufenxi',
      component: () => import('@/view/pinpufenxi/index'),
      redirect:'/pinpufenxi/list',
      children:[
        {
          path: '/pinpufenxi/list',
          component: () => import('@/view/pinpufenxi/list'),
          mete:{
            title:"频谱分析",
          },
        }
      ]
    },
    {
    	path: '/xitong',
      component: () => import('@/view/xitong/index'),
      redirect:'/xitong/xitongguanli',
      children:[
        {
          path: '/xitong/xitongguanli',
          component: () => import('@/view/xitong/list2'),
          mete:{
            title:"系统管理",
          },
        },
        {
          path: '/xitong/dingyizu',
          component: () => import('@/view/xitong/dingyizu/dingyizu'),
          mete:{
            title:"定义组管理",
          },
        },
        {
          path: '/xitong/tuku',
          component: () => import('@/view/xitong/tuku/tuku'),
          mete:{
            title:"图库管理",
          },
        },
      ]
    },
    {
    	path: '/zhoucheng',
      component: () => import('@/view/zhoucheng/index'),
      redirect:'/zhoucheng/zhouchengku',
      children:[
        {
          path: '/zhoucheng/zhouchengku',
          component: () => import('@/view/zhoucheng/list'),
          mete:{
            title:"轴承库",
          },
        }
      ]
    },

    {
    	path: '/menxian',
      component: () => import('@/view/menxian/index'),
      redirect:'/menxian/list',
      children:[
        {
          path: '/menxian/list',
          component: () => import('@/view/menxian/list'),
          mete:{
            title:"门限管理",
          },
        }
      ]
    },

    {
    	path: '/baocuorizhi',
      component: () => import('@/view/baocuorizhi/index'),
      redirect:'/baocuorizhi/list',
      children:[
        {
          path: '/baocuorizhi/list',
          component: () => import('@/view/baocuorizhi/list'),
          mete:{
            title:"报错日志",
          },
        }
      ]
    },

    {
      path: '/shiboqi',
      component: () => import('@/view/shiboqi/index'),
      mete:{
        title:"示波器",
      },
    },
    {
      path: '/shiboqi2',
      component: () => import('@/view/shiboqi/index2'),
      mete:{
        title:"示波器",
      },
    },
    {
      path: '/shiboqitest',
      component: () => import('@/view/shiboqitest/index'),
      mete:{
        title:"示波器测试",
      },
    },
    {
      path: '/xiaogongju',
      component: () => import('@/view/shiboqi/index3'),
      mete:{
        title:"xiaogongju",
      },
    },
	]
})
